<template>
  <div>
    <h3>2021国家基地评估</h3>
    <div>
      <vxe-table resizable show-overflow border max-height="800"  :data="dataList" :merge-cells="mergeCells">
        <vxe-column type="seq" width="60"></vxe-column>
        <vxe-table-column field="title" title="一级指标" sortable></vxe-table-column>
        <vxe-table-column field="subtitle" title="二级指标" sortable></vxe-table-column>
        <vxe-table-column field="subSeq" title="序号" width="60" sortable></vxe-table-column>
        <vxe-table-column field="itemName" title="认定依据" sortable>
          <template #default="{ row }">
            <el-link>{{row.itemName}}</el-link>
          </template>
        </vxe-table-column>
        <vxe-table-column field="systemFill" title="系统填报" width="130" sortable>
          <template #default="{ row }">
            <el-radio-group v-model="row.systemFill" v-if="row.systemFill!=3" @change="radioChange(row,'systemFill')">
              <el-radio label="1">是</el-radio>
              <el-radio label="2">否</el-radio>
            </el-radio-group>
          </template>
        </vxe-table-column>
        <vxe-table-column field="originalScan" title="原件扫描" width="130" sortable>
          <template #default="{ row }">
            <el-radio-group v-model="row.originalScan" v-if="row.originalScan!=3" @change="radioChange(row,'originalScan')">
              <el-radio label="1">是</el-radio>
              <el-radio label="2">否</el-radio>
            </el-radio-group>
          </template>
        </vxe-table-column>
        <vxe-table-column field="offlineManagement" title="线下管理" width="130" sortable>
          <template #default="{ row }">
            <el-radio-group v-model="row.offlineManagement" v-if="row.offlineManagement!=3" @change="radioChange(row,'offlineManagement')">
              <el-radio label="1">是</el-radio>
              <el-radio label="2">否</el-radio>
            </el-radio-group>
          </template>
        </vxe-table-column>
        <vxe-table-column field="memo" title="备注" sortable></vxe-table-column>
      </vxe-table>
    </div>
  </div>
</template>

<script>
  import { base_check_summary,base_check_summary_update } from '@/api/organization.js'
  export default {
    data() {
      return {
        dataList: [],
        defaultDataList: [],
        mergeCells: [
          { row: 0, col: 1, rowspan: 24 },
          { row: 24, col: 1, rowspan: 28 },
          { row: 52, col: 1, rowspan: 42 },
          { row: 94, col: 1, rowspan: 53 },
          { row: 147, col: 1, rowspan: 3 },
          { row: 150, col: 1, rowspan: 3 },

          { row: 0, col: 2, rowspan: 10 },
          { row: 10, col: 2, rowspan: 7 },
          { row: 17, col: 2, rowspan: 3 },
          { row: 20, col: 2, rowspan: 2 },
          { row: 22, col: 2, rowspan: 2 },
          { row: 24, col: 2, rowspan: 8 },
          { row: 32, col: 2, rowspan: 7 },
          { row: 40, col: 2, rowspan: 12 },
          { row: 52, col: 2, rowspan: 5 },
          { row: 57, col: 2, rowspan: 3 },
          { row: 60, col: 2, rowspan: 20 },
          { row: 81, col: 2, rowspan: 13 },
          { row: 94, col: 2, rowspan: 4 },
          { row: 98, col: 2, rowspan: 7 },
          { row: 105, col: 2, rowspan: 3 },
          { row: 108, col: 2, rowspan: 27 },
          { row: 135, col: 2, rowspan: 8 },
          { row: 143, col: 2, rowspan: 4 },
          { row: 147, col: 2, rowspan: 3 },
          { row: 150, col: 2, rowspan: 3 },
        ]
      }
    },
    created() {
      this.getBaseCheckSummary()
    },
    methods: {
      radioChange(row,type) {
        let data = {
          baseCheckSummaryId: row.baseCheckSummaryId,
        }
        data[type] = row[type]
        base_check_summary_update(data).then(res=>{
          if(res.code === 200) {
            this.$message.success('修改成功！')
          }
        })
      },
      getBaseCheckSummary() {
        base_check_summary().then(res=>{
          if(res.code === 200 && res.data.length != 0){
            console.log(res.data)
            this.dataList = res.data
          }
        })
      },
    }
  }
</script>

<style scoped>

</style>
